<?php
declare(strict_types=1);

class c_index extends Control
{
    public function index()
    {
        echo LKS;
    }
    public function info()
    {
        phpinfo();
    }
    public function data()
    {
        $member = new m_member();
        $res = $member->where('id',1)->value('name');
        $this->success(1,$res);
    }
    public function redis()
    {
        
        $redis = Cache::getInstance();
        try {
            $redis->incr('sen');
        } catch (Exception $e) {
            echo $e->getMessage();
        }
        return true;
    }
    public function log()
    {
        $time = new module_time();
        $time->start();
        module_log::create([],1,['test']);
        $a2 = $time->end_nanoseconds();
        $a1 = $time->end_seconds();
        $this->success(1,[$a1,$a2]);
    }
    //计时方法
    public function time(){
        $time = new module_time();
        $time->start();
        $a1 = $time->end_seconds();
        $a2 = $time->end_nanoseconds();
        $this->success(1,[$a1,$a2]);
    }
    public function date()
    {
        $module_date = new module_date();
        $res[] = $module_date->getStartAndEndOfWeek();
        $res[] = $module_date->getStartAndEndOfMonth();
        echo '<pre>';print_r($res);die;
    }
    public string $name = 'index';
    public function strict_types(){
        $this->name = '1';
        echo $this->name;
    }

}